{extend name="layouts/default" /}
{block name="title"}首页{/block}


{block name="content"}
{if isLogin() }
    <?php $user = loginUser();?>
    <div class="row">
        <div class="col-md-8">
            {include file="shared/_topic_form" /}
        </div>
        <div class="col-md-4">
            <div class="d-flex flex-column justify-content-center align-items-center">
                <img src="{$user->avatar}" alt="{$user->name}" width="200" class="img-thumbnail" />
                <h3 class="p-4" style="color:deeppink;">{$user->name}</h3>
            </div>
            <div class="d-flex  justify-content-center align-items-center">
               <div class="d-flex flex-column justify-content-center align-items-center px-4 border-end">
                   <a class="text-decoration-none text-success" href="{:url('user.followings',['id'=>$user->id])}">
                       <?php echo $user->followings()->count();?>
                   </a>
                   <span style="font-size: 13px;" class="text-secondary">关注</span>
               </div>
                <div class="d-flex flex-column justify-content-center align-items-center px-4 border-end">
                    <a class="text-decoration-none text-success" href="{:url('user.followers',['id'=>$user->id])}">
                        <?php echo $user->followers()->count();?>
                    </a>
                    <span style="font-size: 13px;" class="text-secondary">粉丝</span>
                </div>
                <div class="d-flex flex-column justify-content-center align-items-center px-4">
                    <span class="text-decoration-none text-success">
                        <?php echo $user->topics()->count();?>
                    </span>
                    <span style="font-size: 13px;" class="text-secondary">博文</span>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
       <div class="col-md-8">
        {if $count > 0 }
            <div class="card">
                <div class="card-header text-center h3">
                    <i class="fa fa-list-ul text-success"></i>&nbsp;我发的博文列表
                </div>
                <div class="card-body">
                    <ul class="list-group list-group-flush">
                        {foreach $topics as $topic }
                         {include file="topics/_topic" /}
                        {/foreach}
                    </ul>
                    <div class="pages d-flex justify-content-end align-items-center">
                        {$topics|raw}
                        <span class="count">总条数&nbsp;{$count}</span>
                    </div>
                 </div>
                </div>
            {/if}
        </div>
        <div class="col-md-4"></div>
    </div>
</div>
{else /}
    <div class="jumbotron bg-success text-white p-4 rounded">
        <h1 class="display-4">ThinkPHP8入门实战教程</h1>
        <p class="lead">好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。</p>
        <hr class="my-4">
        <p>好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。好好学习，天天向上。</p>
        <a class="btn  btn-outline-warning btn-lg" href="{:url('User/create')}" role="button">现在注册</a>
    </div>
{/if}

{/block}